home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / science / sm32a.zip / LIBRARY / DOTPLOT.LI < prev    next >
Text File  |  1994-07-20  |  616b  |  21 lines

  1. #    dotplot(y,x)
  2. #    plots a function of y=y(x) as dots
  3. #    on xy-plane by default xmin:=-5, xmax:=5, ymin:=-5, ymax:=5
  4. #    e.g. dotplot(sin(x),x)
  5.  
  6. dotplot(y_, x_, xmin_, xmax_, ymin_, ymax_) := block(numeric:=on,
  7.     graph,
  8.     dx:=(xmax-xmin)/getmaxx,
  9.     dy:=(ymax-ymin)/getmaxy,
  10.     xstep:=dx*10,
  11.     axis(xmin,xmax,ymin,ymax),
  12.     moveto(0,getmaxy-(subs(y,x=xmin)-ymin)/dy),
  13.     do( putpixel((x-xmin)/dx,getmaxy-(y-ymin)/dy,colorno(yellow)),
  14.     x,xmin,xmax,xstep),
  15.     numeric:=off,
  16.     readchar,
  17.     text,
  18.     local(dx,dy,xstep))
  19. dotplot(y_, x_, xmin_, xmax_) := dotplot(y,x,xmin,xmax,-5,5)
  20. dotplot(y_, x_) := dotplot(y,x,-5,5,-5,5)
  21.